<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use think\Db;

class Complaint  extends Frontend
{
    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    /**
     * 跳转页面
     * @return string
     * @throws \think\Exception
     */
    public function index(){
        return $this->view->fetch();
    }

    /**
     * 添加备注
     * @return void
     */
    public function save(){
        $data['phone'] = input('post.phone','');
        $data['car_num'] = input('post.car_num','');
        $data['beizhu'] = input('post.beizhu','');
        if(!$data['phone'] && !$data['car_num'] && !$data['beizhu']){
            $this->error('参数错误');
        }
        $data['createtime'] = time();
        $data['updatetime'] = time();
        $res = Db::name('gzh_complaint')->insert($data);
        if($res) $this->success('添加成功');
        else  $this->error('添加失败');
    }

}